package com.wbcs.system.component.application.report.configbean.editablereport;

import java.util.Map;

import com.wbcs.exception.WbcsConfigLoadingException;
import com.wbcs.system.ReportRequest;
import com.wbcs.system.component.application.report.EditableListReportType;
import com.wbcs.util.Tools;

public class EditableListReportUpdateDataBean extends EditableReportUpdateDataBean
{
    private EditableListReportInsertUpdateBean realUpdateBean;

    public EditableListReportUpdateDataBean(IEditableReportEditGroupOwnerBean owner)
    {
        super(owner);
    }

    public EditableListReportInsertUpdateBean getRealUpdateBean()
    {
        return realUpdateBean;
    }

    public void setRealUpdateBean(EditableListReportInsertUpdateBean realUpdateBean)
    {
        this.realUpdateBean=realUpdateBean;
    }

    @Override
	public int parseActionscripts(String reportTypeKey)
    {
        if(this.realUpdateBean.getLstUrlParams()!=null)
        {
            for(Map<String,String> mParamTmp:this.realUpdateBean.getLstUrlParams())
            {
                if(mParamTmp==null||mParamTmp.size()==0) continue;
                if(Tools.isDefineKey("url",mParamTmp.entrySet().iterator().next().getValue()))
                {
                    throw new WbcsConfigLoadingException("加载报表"+this.getOwner().getReportBean().getPath()
                            +"失败，editablelist报表类型的<update/>中urlparams参数不能配置为url{name}，可以配置为request/session{key}和@{column}格式");
                }
            }
        }
        return 1;
    }

    public String assembleAccessPageUrl(ReportRequest rrequest,EditableListReportType reportTypeObj,Object dataObj)
    {
        return this.realUpdateBean.assembleAccessPageUrl(rrequest,reportTypeObj,dataObj);
    }

    public void doPostLoad()
    {
       this.realUpdateBean.doPostLoad();
    }

    @Override
	public void setRealParamnamesInDoPostLoadFinally()
    {
        
    }
    
    @Override
	public Object clone(IEditableReportEditGroupOwnerBean newowner)
    {
        EditableListReportUpdateDataBean newbean=(EditableListReportUpdateDataBean)super.clone(newowner);
        if(this.realUpdateBean!=null)
        {
            newbean.setRealUpdateBean((EditableListReportInsertUpdateBean)realUpdateBean.clone(newbean));
        }
        return newbean;
    }
}
